﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MyMaster.master" AutoEventWireup="true" CodeFile="Laptop.aspx.cs" Inherits="Laptop" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div>
        <div style="border-bottom: solid silver; margin:10px 25px 0px 25px;">
            <br />
            <label style="font-size:20px; margin-left:5px;"><b>Nhà sản xuất</b></label>
            <asp:SqlDataSource ID="sql_hangsx" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                                SelectCommand="SELECT * FROM hangsx
                                                where id_row in (select id_nhasx
				                                                    from sanpham
                                                                    where id_loaisp = @id_loai)
                                                order by tenhang">
                <SelectParameters>
                    <asp:QueryStringParameter Name="id_loai" QueryStringField="id_loai" Type="String" />
                </SelectParameters>
            </asp:SqlDataSource>
            <asp:DataList ID="datalistHangSX" runat="server" DataKeyField="id_row" 
                DataSourceID="sql_hangsx" RepeatColumns="5">
                <ItemTemplate>
                    <br />
                    <table width="150px">
                        <tr>
                            <td style="text-align:center; height:120px;">
                                <asp:Image ID="imgHinhAnh" runat="server" Height="120px" Width="110px" 
                                            ImageUrl='<%# "~/images/NhaSX/" + Eval("tenhang") + ".jpg" %>' />
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align:center; height:20px;">
                                <asp:HyperLink ID="hyp_hangsx" runat="server" ForeColor="DarkBlue" Font-Bold="true" Text='<%# Eval("tenhang") %>'
                                    NavigateUrl='<%# "~/LaptopNhaSX.aspx?id_row=" + Eval("id_row") + "&tenhang=" + Eval("tenhang") %>'>
                                </asp:HyperLink>
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
            </asp:DataList>
            <br />
        </div>
        
        <div style="border-bottom: solid silver; margin:10px 25px 0px 25px;">
            <br />
            <label style="font-size:20px; margin-left:5px;"><b>Sản phẩm mới nhất</b></label>
            <asp:SqlDataSource ID="sql_sanphammoi" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                                SelectCommand="SELECT top 9 * FROM sanpham
                                               where id_loaisp = @id_loai
                                               order by ngaynhap desc">
                <SelectParameters>
                    <asp:QueryStringParameter Name="id_loai" QueryStringField="id_loai" Type="String" />
                </SelectParameters>
            </asp:SqlDataSource>
            <asp:DataList ID="datalistSanPhamMoi" runat="server" DataKeyField="id_row" 
                DataSourceID="sql_sanphammoi" RepeatColumns="3">
                <ItemTemplate>
                    <br />
                    <table  width="200px" style="text-align:center;">
                        <tr>
                            <td style="vertical-align:middle; height:200px; width:200px;">
                                <asp:Image ID="imgHinhAnh" runat="server" Height="200px" Width="200px" 
                                    ImageUrl='<%# "~/File/Sanpham/Images/" + Eval("id_row") + "/hinhdaidien.jpg" %>' />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:HyperLink ID="hyp_tensp" runat="server" ForeColor="DarkBlue" Font-Bold="true" Text='<%# Eval("tensp") %>'
                                            NavigateUrl='<%# "~/LaptopChiTiet.aspx?id_row=" + Eval("id_row")%>' />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lblGiaBan" runat="server" Text='<%# "Giá bán: <b>" + Eval("dongia","{0:###,###}") + " VNĐ</b>" %>' />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lblTinhTrang" runat="server" Font-Size="10" Font-Italic="true" Text='<%# Eval("tinhtrang") %>' />
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
            </asp:DataList>
            <br />
        </div>

        <div style="margin:10px 25px 0px 25px;">
            <br />
            <label style="font-size:20px; margin-left:5px;"><b>Sản phẩm bán chạy</b></label>
            <asp:SqlDataSource ID="sql_sanphambanchay" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                                SelectCommand="SELECT * FROM sanpham
                                                        where id_row in (select top 9 id_sp
					                                                        from chitiethoadon
					                                                        group by id_sp
					                                                        order by sum(soluong) desc)
                                                 and id_loaisp = @id_loai">
                <SelectParameters>
                    <asp:QueryStringParameter Name="id_loai" QueryStringField="id_loai" Type="String" />
                </SelectParameters>
            </asp:SqlDataSource>
            <asp:DataList ID="datalist1" runat="server" DataKeyField="id_row" 
                DataSourceID="sql_sanphambanchay" RepeatColumns="3">
                <ItemTemplate>
                    <br />
                    <table  width="200px" style="text-align:center;">
                        <tr>
                            <td style="vertical-align:middle; height:200px; width:200px;">
                                <asp:Image ID="imgHinhAnh" runat="server" Height="200px" Width="200px" 
                                    ImageUrl='<%# "~/File/Sanpham/Images/" + Eval("id_row") + "/hinhdaidien.jpg" %>' />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:HyperLink ID="hyp_tensp" runat="server" ForeColor="DarkBlue" Font-Bold="true" Text='<%# Eval("tensp") %>'
                                            NavigateUrl='<%# "~/LaptopChiTiet.aspx?id_row=" + Eval("id_row")%>' />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lblGiaBan" runat="server" Text='<%# "Giá bán: <b>" + Eval("dongia","{0:###,###}") + " VNĐ</b>" %>' />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lblTinhTrang" runat="server" Font-Size="10" Font-Italic="true" Text='<%# Eval("tinhtrang") %>' />
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
            </asp:DataList>
            <br />
        </div>
    </div>
</asp:Content>

